import { app } from 'electron'
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
import createWindow from './createWindow'
import isDev from 'electron-squirrel-startup'

if (isDev) {
  app.quit();
}

app.whenReady().then(() => {
  electronApp.setAppUserModelId('com.electron')
  createWindow();

  app.on('ready', () => {
    if (app.browserWindows.length === 0) {
      createWindow();
    }
  });

  app.on('browser-window-created', (_, window) => {
    optimizer.watchWindowShortcuts(window)
  })
});

app.on('window-all-closed', () => {
  if (process.platform !== 'darwin') {
    app.quit();
  }
});